#include<bits/stdc++.h>
#include<string>
using namespace std;
/*整个递归执行过程是一棵二叉树，先会递归到整棵树的底部，底部只有一个节点一定有序，
然后在回溯时不断合并相邻两个区间，每次合并之后都会将合并之后的区间排好序。那么当合并到根节点时，整个区间就有序了。*/
const int N = 1e5 + 10;
int q[N], tmp[N];//tmp数组存答案，直接存入q会破坏原数组

void merge_sort(int q[], int l, int r){
    if (l >= r) return;

    int mid = l+(r-l)/2;//找到中间值,防止数据过大溢出
    merge_sort(q, l, mid), merge_sort(q, mid + 1, r);//先递归排序

    int k = 0, i = l, j = mid + 1;//k表示已经合并的数量
    while (i <= mid && j <= r)
        if (q[i] <= q[j]) tmp[k ++ ] = q[i ++ ];
        else tmp[k ++ ] = q[j ++ ];
    while (i <= mid) tmp[k ++ ] = q[i ++ ];
    while (j <= r) tmp[k ++ ] = q[j ++ ];

    for (i = l, j = 0; i <= r; i ++, j ++ ) q[i] = tmp[j];
}
int main(){
	int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i ++ ) scanf("%d", &q[i]);

    merge_sort(q, 0, n - 1);

    for (int i = 0; i < n; i ++ ) printf("%d ", q[i]);
	system("pause");

	return 0;
}
